<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text" placeholder="输入你的手机号" id="inpu" />
<button id="btn">点击</button>
</body>
<script>
    var oBtn = document.getElementById('btn');
    oBtn.onclick = function () {
        var oIput = document.getElementById('inpu').value;
        if ( !(/^1[34578]\d{9}$/.test(oIput))) {
            alert("你输入手机号有误");
        } else {
            alert("登录成功");
        }
    }
</script>
</html>